﻿/*-----------------------------------------------------------------------
 * <copyright file="ParentIDPage.xaml.cs" company="O-RID">
 *     Copyright (c)2010 O-RID Co.,Ltd.
 * </copyright>
 * <author>Zhang jun</author>
 * <summary>
 *             ParientID查询
 * 
 *          作成日：06/29/2011
 *                  
 * </summary>
 *----------------------------------------------------------------------- 
 */

namespace Orid.Management.Statistics.OperatorUnitMangement.TheOthersRelated.ParentIDQuery
{
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Navigation;

    public partial class ParentIDPage : Page
    {
        bool isExpanded = false;

        ParentIDContainter parentIDContainter = null;

        public ParentIDPage()
        {
            InitializeComponent();
        }

        // 当用户导航到此页面时执行。
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            #region
            parentIDContainter = new ParentIDContainter();

            this.bParentIDPage.Child = parentIDContainter;

            parentIDContainter.accoridon.SelectedItemsChanged -= new System.Collections.Specialized.NotifyCollectionChangedEventHandler(accoridon_SelectedItemsChanged);
            parentIDContainter.accoridon.SelectedItemsChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(accoridon_SelectedItemsChanged);
            #endregion

            IsExpanded();
        }

        /// <summary>
        /// Haccoridon 选择ITME事件
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The instance containing the event data.</param>
        void accoridon_SelectedItemsChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            IsExpanded();
        }

        /// <summary>
        /// 判断 accoridon 收缩或展开时，DATAGRID的位置
        /// </summary>
        void IsExpanded()
        {

            #region
            if (isExpanded == true)
            {
                this.parentIDContainter.rowAccordionHeight.Height = new GridLength(92);
            }
            else//
            {
                this.parentIDContainter.rowAccordionHeight.Height = new GridLength(25);
            }
            #endregion

            this.isExpanded = !this.isExpanded;
        }
    }
}
